#ifndef _COVER_H_
#define _COVER_H_

#include <vector>

/**
 * @param   array   "cover status" array (1=covered, 0=not)
 * @param   n	    number of elements of array
 * @return  true if all elements of array == 1
 */
bool finished(int *array, size_t n);

/**
 * Cover matrix with given row, covering each column with a 1 and removing
 * 1's from covered columns, also updating row and column sums as necessary.
 * @param   matrix	0-1 matrix
 * @param   rowi	index of row to cover with
 * @param   cover	array indicating covered columns (1=covered, 0=not)
 * @param   rowsums	int[] of row sums, NULL if not needed
 * @param   colsums	int[] of column sums, NULL if not needed
 */
void cover_with_row (
	std::vector< std::vector<int> > &matrix,
	size_t rowi,
	int *cover,
	int *rowsums,
	int *colsums
    );

/**
 * Initialize the row and/or column sum arrays with the given matrix.
 *
 * @param   matrix	binary
 * @param   rowsums	int[] of row sums, NULL if not needed
 * @param   colsums	int[] of column sums, NULL if not needed
 */
void initialize_row_column_sums (
	std::vector< std::vector<int> > &matrix,
	int *rowsums,
	int *colsums
	);

#endif
